import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/Login/Login.vue'
import Regist from '@/views/Regist/Regist.vue'
import Layout from '@/views/Layout/Layout.vue'
import Home from '@/views/Home/Home.vue'
import Detail from '@/views/Detail/Detail.vue'
import Cart from '@/views/Cart/Cart.vue'
import My from '@/views/My/My.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: Layout,
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          component: Home
        }
        ,
        {

          path: '/my',
          name: 'my',
          component: My

        }
        ,

        {
          path: '/detail/:id',
          component: Detail,
          name: 'detail'
        }
        ,
        {
          path: '/cart',
          component: Cart,
          meta: { isCart: true }
        }
        ,
        {
          path: '/search',
          component: () =>import('../views/Search/Search.vue')
        },
        {
          path: '/order',
          component: () => import('../views/Order/Order.vue'),
          meta: { isCart: true,isKeep: true }
        }
        ,
        {
          path: '/success',
          component: () => import('../views/Success/Success.vue')
        }

      ]
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    }
    ,
    {
      path: '/regist',
      name: 'regist',
      component: Regist
    }
    ,
    {
      path: '/offical',
      component: () => import('../views/OfficalWeb/OfficalWeb.vue')
    }
    ,
    {
      path: '/server',
      component: () => import('../views/CustomServer/CustomServer.vue')
    }

  ]
})

export default router
